Release 10.1A: OpenEdge Development:
Progress 4GL Reference
DEFINE MENU statement
Defines and creates a pop-up menu or a menu bar for use in one or more procedures.
Note: Does not apply to SpeedScript programming.Syntax
NEW SHARED MENUmenu-nameDefines and identifies a menu that can be used by other procedures. The menu remains available to other procedures until the procedure that contains this statement ends.
SHARED MENUmenu-nameDefines and identifies a menu that was created in another procedure with the DEFINE NEW SHARED MENU statement.
[ PRIVATE ] MENUmenu-nameDefines and identifies a menu widget as a data member for a class, and optionally specifies an access mode for that data member. Do not specify the access mode when defining a menu widget for a method within a class.
PRIVATE data members can be accessed only by the defining class. The default access mode is PRIVATE.
Note: This option is applicable only when defining a data member for a class in a class definition (.cls) file.MENUmenu-nameIdentifies the name of the menu you are defining. You can define the menu widget in a procedure or a method within a class.
BGCOLORexpressionSupported only for backward compatibility. Progress does not support this option in Windows or character interfaces.
DCOLORexpressionSpecifies the display color for the menu in character interfaces. This option is ignored in graphical interfaces.
FGCOLORexpressionSupported only for backward compatibility. Progress does not support this option in Windows or character interfaces.
PFCOLORexpressionSpecifies the prompt-for color for the menu in character interfaces. This option is ignored in graphical interfaces.
FONTnumberSupported only for backward compatibility. Progress does not support this option in Windows or character interfaces.
MENUBARSpecifies that the menu displays as a menu bar.
TITLEtitleSpecifies the title of the menu. Only pop-up menus can have titles. This option is invalid for menu bars. The title displays at the top of the menu. In environments that do not support this option, it is ignored.
LIKEmenuSpecifies a previously defined menu whose characteristics you want to apply to the new menu. If you name a menu with this option, you must have defined that menu previously in the procedure.
menu-element-descriptorSpecifies an element display on the menu. Each element is either a normal menu item, a submenu, a rule, or a blank space. The last two are valid only for pop-up menus. You must specify one or more menu elements, unless you use the LIKE option.
This is the syntax for
menu-element-descriptor:
RULESpecifies that a rule or line is inserted at this point in the menu. You can use this, for example, to divide the menu into sections.
SKIPSpecifies that a blank line is inserted at this point in the menu. You can use this, for example, to divide the menu into sections.
SUB-MENUsubmenu[ DISABLED ] [ LABELlabel]Specifies that a submenu displays as a menu item. The submenu must be previously defined in the procedure. The submenu appears when the user chooses that item. The submenu cannot be a menu bar. The DISABLED and LABEL options for a submenu are the same as described for the
menu-item-phrase.menu-item-phraseSpecifies a normal menu item. This is the syntax for
menu-item-phrase:
MENU-ITEMmenu-item-nameThe name of the menu item you are defining.
ACCELERATORkeylabelSpecifies a keyboard accelerator for this menu item. A keyboard accelerator is a key—sometimes modified by SHIFT, CONTROL, or ALT—that chooses a menu item even if the menu is not displayed. The value
keylabelmust be character-string expression that evaluates to a valid key label recognized by Progress, such as a, F1, or ALT+SHIFT+F1.BGCOLORexpressionSpecifies the background color for the menu item in graphical environments. If you omit this option, the menu item inherits the background color of the menu.
DCOLORexpressionSpecifies the display color for the menu item in character interfaces. If you omit this option, the menu item inherits the display color of the menu.
DISABLEDSpecifies that the menu item is initially disabled for input. This means that the user cannot choose this item. Disabled items are grayed out (in environments that support it).
FGCOLORexpressionSpecifies the foreground color for the menu item in graphical environments. If you omit this option, the menu item inherits the foreground color of the menu.
FONTexpressionSpecifies the font for the menu item. If you omit this option, the menu item inherits the font of the menu.
LABELlabelSpecifies the text that is displayed in the menu for a choosable menu item or submenu. Include an ampersand (&) within the label to assign the following letter as a mnemonic for the menu item. This means that when the menu is displayed, the user can choose the item by pressing that single key. If you do not include an ampersand within the label, Windows treats the first character as a mnemonic.
To include a literal ampersand within a label, specify two ampersands (&&).
PFCOLORexpressionSpecifies the prompt-for color for the menu item in character interfaces. If you omit this option, the menu item inherits the prompt-for color of the menu.
READ-ONLYSpecifies that this menu item is read-only text. The user cannot choose this item.
TOGGLE-BOXSpecifies that the menu item is displayed as a checkbox that the user can toggle on or off. In environments that do not support this option, it is ignored.
trigger-phraseSpecifies application triggers for the menu item. Typically, you associate a CHOOSE trigger with each menu item.
For more information, see the Trigger phrase reference entry.
ExampleThe
r-bar.pprocedure defines a menu bar, mbar, that contains three pull-down submenus labeled Topic, Move, and Exit. The handle of mbar is assigned to the current window. The ON statements define triggers to execute when you choose the corresponding menu items.
Notes
- You cannot define a SHARED or NEW SHARED menu widget in a persistent procedure. If you do, Progress raises ERROR on the RUN statement that creates the procedure.
- You cannot define a SHARED or NEW SHARED menu widget in a class definition (
.cls) file. If you do, Progress generates a compilation error.- Keyboard accelerators are specified for menu-items forward and backward. The user can press PAGE-DOWN key to look at the next customer record and the PAGE-UP to view the previous customer record.
- The menu item quititem has a label E&xit; the ampersand makes X the mnemonic for that menu item.
- You cannot define a submenu with the same name more than once in the same menu tree. Thus, if menu mFile contains both submenu mOptions and submenu mSave, submenu mSave cannot also contain submenu mOptions.
- Menu items in different menus and submenus can have the same names. In the above procedure, the menu items in myfile and myobjects share the same names. To avoid ambiguity, use the IN MENU or IN SUB-MENU option to identify the parent menu or submenu.
- There are instances where you cannot avoid ambiguity in menu item references. In such instances, Progress always references the first unambiguous instance of the menu item. In particular, if the same submenu containing a menu item appears in more than one menu and each menu defines another instance of the same menu item, you can only reference that menu item in the submenu from the first menu that contains it. Thus, if submenu mOptions contains menu item mSave and the menus mFile and mDraw (in that order) both contain submenu mOptions and another menu item mSave, you can only reference menu item mSave in submenu mOptions from menu mFile. You cannot uniquely reference menu item mSave in submenu mOptions from menu mDraw because menu mDraw contains another menu item mSave. For more information on menu item references, see the chapter on menus in OpenEdge Development: Progress 4GL Handbook .
See also
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |